package com.sfeir.client.tetriselement;

import static com.sfeir.client.util.Constants.SQUARE_SIZE;

import com.google.gwt.canvas.dom.client.Context2d;
import com.google.gwt.dom.client.ImageElement;
import com.google.gwt.user.client.ui.Image;
import com.sfeir.client.util.Constants;
import com.sfeir.canvas.util.client.ResourceManager;

public class SquareObject extends TetrisObject {

	private static final boolean[][] matrix1 = new boolean[4][4];

	static {
		matrix1[1][1] = true;
		matrix1[1][2] = true;
		matrix1[2][1] = true;
		matrix1[2][2] = true;
	}

	private final Image image;

	public SquareObject(ResourceManager manager) {
		super(manager.getImage(Constants.KEY_IMAGE_SQUARE_PART), matrix1, matrix1, matrix1, matrix1);
		this.image = manager.getImage(Constants.KEY_IMAGE_SQUARE);
	}

	@Override
	public void draw(Context2d ctx) {
		ctx.drawImage(ImageElement.as(this.image.getElement()), -SQUARE_SIZE, -SQUARE_SIZE);
	}

	@Override
	protected int adjustXToFitCase() {
		return 0;
	}

	@Override
	protected int adjustYToFitCase() {
		return 0;
	}

	@Override
	protected int adjustXToFitCenter() {
		return 0;
	}

	@Override
	protected int adjustYToFitCenter() {
		return 0;
	}

}
